﻿@using Webdiyer.WebControls.Mvc
@model PagedList<Dyd.BaseService.ConfigManager.Domain.Model.tb_category_model>
@{
    ViewBag.Title = "分类列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@Html.AntiForgeryToken()
<div class="head">
    <div class="title">
        @ViewBag.Title
    </div>
</div>
<div>
    @Html.ActionLink("新增", "CategoryAdd", null, new { @class = "btn1",target="_blank" })
</div>
<div class="orderlist m10 myorder">
    @using (Html.BeginForm("CategoryIndex", "Category", FormMethod.Get, new RouteValueDictionary { { "id", "searchForm" } }))
    {
        <div class="search">

            <label>分类名</label><input type="text" class="text midtext" style="width:150px;" name="name" value="@ViewBag.Name" />

            <label>备注</label><input type="text" class="text midtext" style="width:200px;" name="remark" value="@ViewBag.Remark" />

            <input type="submit" class="btn1" value="搜索" accesskey="S" />
        </div>
    }
    <div class="tab_cont">
        <div class="List">
            @Html.Partial("_CategoryIndex", Model)
        </div>
    </div>
</div>
@section Scripts{
    <script>
        $(function () {
            $("body").on("click", ".edit", function () {
                var id = $(this).parent().parent().attr("data-id");
                var url = "/Category/CategoryEdit/" + id;
                window.location = url;
            });

            $("body").on("click", ".del", function (e) {
                var id = $(this).parent().parent().attr("data-id");
                var url = "/Category/CategoryDel";
                if (window.confirm("确定要删除吗？")) {
                    $.post(url, addAntiForgeryToken({ id: id }), function (data) {
                        if (data.Flag) {
                            alert(data.Message);
                            window.location.reload();
                        }
                        else {
                            alert(data.Message);
                        }
                    }, "json");
                }
            });

            $("body").on("click", ".reload", function (e) {
                var id = $(this).parent().parent().attr("data-id");
                var url = "/Category/ClientReloadConfig";
                if (window.confirm("确定要通知客户端重新初始化项目配置吗？")) {
                    $.post(url, addAntiForgeryToken({ id: id }), function (data) {
                        if (data.Flag) {
                            alert(data.Message);
                            window.location.reload();
                        }
                        else {
                            alert(data.Message);
                        }
                    }, "json");
                }
            });
        });

    </script>
}